package com.xbao.dao;

import com.xbao.model.req.OrgReq;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.cache.annotation.Cacheable;

/**
 * Created by qingshengzheng on 2019/1/23.
 */
@Mapper
public interface OrgExtraMapper {
    public void updateOrg(OrgReq orgReq);

    @Cacheable(key = "'getEmpCountOfOrg'+#orgid")
    @Select("select count(1) from emp where orgid=#{orgid}")
    public Integer getEmpCountOfOrg(Long orgid);

    @Select("select count(1) from room where orgid=#{orgid}")
    //@Cacheable(key="'getRoomCountOfOrg'+#orgid")
    public Integer getRoomCountOfOrg(Long oid);

    @Select("select count(1) from room where orgid=#{orgid}")
    //@Cacheable(key="'getSubjectCountOfOrg'+#orgid")
    public Integer getSubjectCountOfOrg(Long oid);
    @Update("update emp_org_rel set mainflag=0 where eid=#{eid}")
    public void resetUnMainOrg (Long eid);
}
